Skip to content

chore: untrack appsettings.Development.json, keep its defaults as an example - #591

Merged
mforce merged 1 commit into
mainfrom
chore/untrack-dev-appsettings
Aug 24, 2026
Merged

mforce merged 1 commit into
mainfrom
chore/untrack-dev-appsettings

Conversation

@mforce

@mforce mforce commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Found while reviewing an unrelated branch: src/Cluckwork.Api/appsettings.Development.json showed up as modified in the working tree, carrying a local Postgres connection string and password. The file was tracked, so that edit sat one git commit -a away from committing a credential into a repo GitGuardian scans.

Why untrack rather than just revert

AGENTS.md already says, twice, that dev secrets belong in user-secrets — and UserSecretsId is configured, so the supported path needs no code change:

dotnet user-secrets --project src/Cluckwork.Api set "ConnectionStrings:Default" "..."

Reverting alone fixes today and not tomorrow: a tracked appsettings.Development.json is the path of least resistance for exactly the value user-secrets exists to hold, and the next person hits it the same way.

Why the config didn't just disappear

Untracking on its own would have deleted the shared, non-secret Serilog dev config for every other clone — the log levels and the {TraceId}:{SpanId} output template that decision #404 depends on. Those move to appsettings.Development.example.json, mirroring the existing deploy/.env.example pattern. Git records it as a rename because the content is byte-identical.

Checked before removing

Nothing referenced the tracked file: no csproj item (the Web SDK globs appsettings*.json), and no reference in Dockerfile, .github/, deploy/, tools/, or any doc. A fresh clone simply falls back to appsettings.json until someone copies the example.

Deliberately not touched

.gitignore already carries an entry for appsettings.Development.local.json — and nothing in the app loads that file. There is no AddJsonFile for it, and ASP.NET Core does not pick up .local.json by default, so anyone following that hint puts config somewhere silently never read. That is a real latent trap, but it is a separate question and is left exactly as-is by owner decision. Flagging it here so it is on the record rather than rediscovered.

Scope

Kept off feat/535-spa-farm-code-prefill (#588) on purpose — that PR is frontend-only and three review rounds have verified it touches nothing under src/. This is unrelated and belongs on its own branch.

…example

The file was tracked, so a local connection string edited into it showed up as
a modification in an unrelated feature branch's diff — one `git commit -a` away
from committing a credential into a repo that GitGuardian scans.

AGENTS.md already says twice that dev secrets belong in user-secrets, and
`UserSecretsId` is configured, so the supported path needs no code change:

    dotnet user-secrets --project src/Cluckwork.Api set "ConnectionStrings:Default" "..."

Untracking it alone would have deleted the shared, non-secret Serilog dev
config — the log levels and the {TraceId}:{SpanId} output template #404 cares
about — for every other clone. So those move to
appsettings.Development.example.json, mirroring the deploy/.env.example pattern.

Nothing referenced the tracked file: no csproj item (the Web SDK globs
appsettings*.json), no Dockerfile, CI, compose or docs reference.

Deliberately NOT touched: the pre-existing `.gitignore` entry for
appsettings.Development.local.json, which nothing in the app loads. That dead
hint is a separate question and is left as-is by owner decision.
@mforce
mforce merged commit 3e3055e into main Aug 24, 2026
7 of 8 checks passed
@mforce
mforce deleted the chore/untrack-dev-appsettings branch August 24, 2026 04:33

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c241d4bfb4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .gitignore
# by accident, and it was tracked, so a local edit rode along into every diff.
# Untracked now; appsettings.Development.example.json carries the shared,
# non-secret Serilog defaults that used to live here.
src/Cluckwork.Api/appsettings.Development.json

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exclude the local config from Docker builds

When a developer retains or creates this newly ignored file with a connection-string credential—the exact accident this change is intended to contain—the documented Compose build still sends it because .dockerignore does not exclude it; Dockerfile then runs COPY . . followed by dotnet publish, whose Web SDK glob packages appsettings*.json. The credential therefore becomes readable from the locally built production image even though Git no longer reports the file, so add this path to .dockerignore as well.

AGENTS.md reference: AGENTS.md:L119-L120

Useful? React with 👍 / 👎.

mforce added a commit that referenced this pull request Aug 24, 2026
…s as an example (#591)" (#592)

This reverts commit 3e3055e.

Co-authored-by: mforce <mforce@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants